// 键盘按键按下时触发的效果
function handleDown(e) {
  console.log('handleDown')
}
// 按键时打印出字符时触发的函数
function handlePress(e) {
  console.log('handlePress')
}
// 按键松开时触发的函数
function handleUp(t) {
  // keyCode是每个键盘上的按键对应的数字
  let { keyCode } = event
  console.log('handleUp')
  if (keyCode === 13) {
    console.log('你点击了回车')
    console.log(t)
    let value = t.value
    console.log(value)
  }
}

let username = document.querySelector('.username')
username.onkeydown = function (e) {
  console.log(e)
}
username.onkeyup = function (e) {
  let { keyCode } = e || event
  if (keyCode === 13) {
    console.log('你点击了回车')
    let value = this.value
    console.log(value)
  }
}
